<?php 
namespace Admin\Controller;
use Think\Controller;

class LoginController extends Controller {
    	public function index()
    	{
    		$this->display();
    	}


    	
    	public function checkdate(){

    		//用户名密码验证
    		$user = I('post.nickname');
    		// var_dump(D('user')->checkEmail($user));exit();
    		$password = I('post.password');
  		if ($res= D('user')->checkdate($user,$password)) {
  			$arr = array(
    					'error' => 0,
    					'info' => '登录成功'
    				);

    			echo json_encode($arr);
    			$_SESSION['aid']=$res['id'];
    			$_SESSION['anickname']=$res['nickname'];
    			$_SESSION['aface']=$res['face'];
  		}else{
  			$arr = array(
    					'error' => 1,
    					'info' => '用户名密码错误'
    				);
    			echo json_encode($arr);
    			exit();
  		}
    	
    
	}
        public function loginout()
    {
        session_unset();
        session_destroy();
        $this->success('退出成功',U('home/index/index'),0);
    }







}

 ?>